package com.rtx.api.utils;


import cn.hutool.json.JSONUtil;

public class DataTypeUtils {

	//判断数据类型是JSON 还是 XML
	public static String resolveDataTypeAndConvertToJsonStr(String data) {
		String str = data;
		try {
			if(data.startsWith("<")&&data.endsWith(">")) {
				str = JSONUtil.parseFromXml(data).toJSONString(0);
			}
		} catch (Exception e) {
			throw new RuntimeException("XML转成JSON异常-",e);
		}

		return str;
	}
	
}
